package com.hk.exception;


import com.hk.core.Result;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandle {
@ExceptionHandler
    public Result ex(Exception e){

        log.info("全局异常拦截器捕捉到异常",e);
        String message = e.getMessage();
        if(message==null||message==""){ return Result.error("请求失败，请联系管理员");}
        return Result.error(message);
    }
}
